package com.jl.book.util

import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.fragment.app.Fragment
import com.jl.book.global.TITLE
import com.jl.book.global.URL
import com.jl.book.ui.base.MainActivity

/**
 *@author jl
 */
fun desTo(fragment: Fragment, id: Int) {
    val navController = (fragment.requireActivity() as MainActivity).getNavController()
    try {
        val desId = navController.getBackStackEntry(id).destination.id
        navController.popBackStack(desId, false)
    } catch (e: IllegalArgumentException) {
        navController.navigate(id)
    }
}
